import { http } from "@/utils/http";
import type { AxiosResultDefault } from "./type";

type ResultTable = {
  total?: number;
  data?: Array<any>;
};

// PID图-查询PID图上点位实时值
export const querySpecValues = (data?: object) => {
  return http.request<ResultTable>("post", `/data/api/v1/dataQuery/queryLastScadaValue`, {
    data
  });
};

// 删除报告
export const deleteReport = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/dosing/deleteReport`, {
    data
  });
};

// 根据抄表组查询抄表项目指标-在线指标
export const getMeterReadingGroup = (data?: object) => {
  return http.request<ResultTable>("post", `/sharing/api/v1/meterReadingGroup/getMeterReadingGroup2`, {
    data
  });
};

// 离线指标
export const offlineIndicators = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/exhause/offlineIndicators`, {
    data
  });
};

// 查询最大值最小值平均值
export const queryScadaIndicator = (data?: object) => {
  return http.request<ResultTable>("post", `/data/api/v1/dataQuery/queryScadaIndicator`, {
    data
  });
};

// 获取洁净间最新Q测值与在线值的对比柱状图数据
export const getDetectedValuesInPair = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/cr/visual/getDetectedValuesInPair`, {
    data
  });
};

// 获取洁净间检测指标累计趋势
export const getTestTypeTrend = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/operation/algorithm/queryTimePredicatedCleanRoomData`, {
    data
  });
};

// 废气历史数据分析接口变更
export const getEXHData = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/operation/algorithm/queryTimePredicatedEXHListData`, {
    data
  });
};

// 水质及加药接口变更
export const getWaterAddDrugData = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/operation/algorithm/queryTimePredicatedMachineData`, {
    data
  });
};

// 获取洁净室所有区域下点位列表
export const getReadersInZoneByTypes = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/machine/cr/visual/getReadersInZonesByType`, { data }, { headers: { noLoading: true } });

// 获取区域报警数
export const getAreaWarnings = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/sharing/api/v1/alarm/countByList`, { data }, { headers: { noLoading: true } });

// 获取点位表底量程
export const getMaxMin = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/account/api/v1/publish/point/queryPointByMeasureCodes`, { data }, { headers: { noLoading: true } });

// 获取Q部门数据
export const queryQCheck = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/operation/algorithm/queryQCheck`, { data }, { headers: { noLoading: true } });

// 获取点位上下限
export const getPID = (data?: object | undefined) =>
  http.request<AxiosResultDefault>(
    "post",
    `/operation/api/v1/machine/cr/visual/getReadersValueInZonesByType`,
    { data },
    { headers: { noLoading: true } }
  );

// 洁净室热力溯源
export const getHeatMap = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/machine/cr/visual/heatmap`, { data }, { headers: { noLoading: true } });

// 获取机械科宣导栏
export const queryMachineAvocacy = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/handover/page/handoverRecord`, { data }, { headers: { noLoading: true } });

// 平台概览|其他科室指标
export const dashboardqueryOtherDeptIndicator = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/machine/queryOtherChart`, { data }, { headers: { noLoading: true } });

// 在线水质检测
export const onLineWaterTest = (data?: any) =>
  http.request<AxiosResultDefault>(
    "post",
    `/operation/api/v1/machine/detect/waterQuality/listOnlineIndicators/${data}`,
    {},
    { headers: { noLoading: true } }
  );

// 在线水质检测曲线
export const getOnlineData = (data?: object | undefined) =>
  http.request<AxiosResultDefault>(
    "post",
    `/operation/api/v1/machine/detect/waterQuality/queryOnlineReport`,
    { data },
    { headers: { noLoading: true } }
  );
